/**
 * @param {number} target
 * @param {number[]} nums
 * @return {number}
 */
var minSubArrayLen = function (target, nums) {
  let left=0,right=0,sum=0,minLen=0
  while(right<nums.length){
    sum+=nums[right]
    while(sum>= target){
      minLen = Math.min(right-left+1,minLen)
      left++
    }
    right++
  }
  return minLen
}

console.log(minSubArrayLen(7, [2, 3, 1, 2, 4, 3]))
